from google.appengine.ext import db

class TournyPlayer(db.Model):

  tournament  = db.StringProperty()
  event   = db.StringProperty()

  usta    = db.StringProperty()
  name    = db.StringProperty()
  fname   = db.StringProperty()
  lname   = db.StringProperty()
  email   = db.StringProperty()

  register= db.DateTimeProperty()
  survey= db.DateTimeProperty()
  updated= db.DateTimeProperty(auto_now=True)

#

class USTATeam(db.Model):
  idx = db.StringProperty()
  teamid = db.StringProperty()
  name   = db.StringProperty()
  year = db.StringProperty()
  league = db.StringProperty()
  level = db.StringProperty()
  win = db.IntegerProperty()
  loss = db.IntegerProperty()
  updated= db.DateTimeProperty(auto_now=True)

class USTASeasonRecord(db.Model):
  league = db.StringProperty()        #2011 Adult League Womens 4.0
  id = db.StringProperty()            #id of player
  usta = db.StringProperty()
  name = db.StringProperty()
  fname = db.StringProperty()
  lname = db.StringProperty()
  gender = db.StringProperty()
  rating = db.StringProperty()
  win = db.StringProperty()
  loss = db.StringProperty()


class League(db.Model):
  idx = db.IntegerProperty()
  teamid = db.IntegerProperty()
  name   = db.StringProperty()
  year = db.StringProperty()
  league = db.StringProperty()
  level = db.StringProperty()
  win = db.IntegerProperty()
  loss = db.IntegerProperty()
  updated= db.DateTimeProperty(auto_now=True)

class Standings(db.Model):
  idx = db.IntegerProperty()
  teamid = db.IntegerProperty()
  name   = db.StringProperty()
  year = db.StringProperty()
  league = db.StringProperty()
  level = db.StringProperty()
  win = db.IntegerProperty()
  loss = db.IntegerProperty()
  updated= db.DateTimeProperty(auto_now=True)

class SelfRatePlayer(db.Model):
  id = db.StringProperty()
  usta = db.StringProperty()
  ustaid = db.StringProperty()
  name = db.StringProperty()
  fname = db.StringProperty()
  lname = db.StringProperty()
  gender = db.StringProperty()
  rating = db.StringProperty()
  win = db.IntegerProperty()  
  loss = db.IntegerProperty()  
  teamname = db.StringProperty()
  teamid = db.IntegerProperty()

class Player(db.Model):
  id = db.StringProperty()
  usta = db.StringProperty()
  name = db.StringProperty()
  fname = db.StringProperty()
  lname = db.StringProperty()
  gender = db.StringProperty()
  rating = db.StringProperty()
  city = db.StringProperty()


# ---------------------------------

class Team(db.Model):
  position = db.IntegerProperty()
  teamid = db.IntegerProperty()
  name = db.StringProperty()
  captain = db.StringProperty()
  page = db.TextProperty()
  updated= db.DateTimeProperty()
  xrosterkey=db.ListProperty(db.Key)

class Roster(db.Model):
  teamid = db.IntegerProperty()
  playerid = db.IntegerProperty()
  fname = db.StringProperty()
  lname = db.StringProperty()
  roster= db.StringProperty()
  date= db.DateProperty()
  city = db.StringProperty()
  gender = db.StringProperty()
  rating = db.StringProperty()


